package services;

import POJO.UserInfo;
import lombok.Data;
import lombok.ToString;
import mapper.UserInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import utils.MyBatisUtil;

import java.util.List;

/**
 * @Author XW
 * @Date 2022/4/24
 * @Time 9:08
 **/
@Service
@Data
@ToString
public class UserInfoService {
    @Autowired
    UserInfoMapper userInfoMapper;
//    UserInfoMapper userInfoMapper = MyBatisUtil.getSession().getMapper(UserInfoMapper.class);
    public List<UserInfo> selectAll(){
        return userInfoMapper.selectAll();
    }
    public int addUser(UserInfo userInfo){

        return userInfoMapper.addUser(userInfo);
    }
    public int deleteUser(int id){

        return userInfoMapper.deleteUser(id);
    }
    public int updateUser(UserInfo userInfo){

        return userInfoMapper.updateUser(userInfo);
    }
    public List<UserInfo> login(String userName, String password){
        return userInfoMapper.login(userName,password);
    }
}
